from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin
from blog_system.models import UserInfo, Link, AD
from django.contrib import admin
# Register your models here.


# admin界面注册
@admin.register(UserInfo)
class UserInfoAdmin(UserAdmin):
    # 页面展示字段
    list_display = ('id', 'username', 'email', 'phone', 'date_joined', 'last_login', 'is_active', 'is_superuser')
    list_per_page = 20


# 友情链接
@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
    search_fields = ('title',)
    list_display = ('title', 'url')
    list_filter = ('create_time',)
    fields = ('title', 'url',)


# 广告
@admin.register(AD)
class ADAdmin(admin.ModelAdmin):
    list_display = ('url', 'img')


admin.site.site_title = 'Vblog管理后台'
admin.site.site_header = 'Vblog管理'
admin.site.unregister(Group)
